home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 1.iso
/
ARGONET
/
PD
/
MATHS
/
RLAB
/
RLAB125.ZIP
/
!RLaB
/
examples
/
contour
< prev
next >
Wrap
Text File
|
1995-05-20
|
948b
|
58 lines
#
# Simple contour plotting demonstration
#
NX = 20;
NY = 20;
xx = zeros (1, NX);
yy = zeros (1, NY);
for (i in 1:NX) { xx[i] = (i - NX/2)/(NX/2); }
for (i in 1:NY) { yy[i] = (i - NY/2)/(NY/2); }
zz = zeros (NX, NY);
for (i in 1:NX)
{
for (j in 1:NY)
{
r = sqrt (xx[i]^2 + yy[j]^2);
zz[i;j] = exp (-r * r) * cos (2*pi*r);
}
}
# Sin - Cos surface
x1 = -3:3:.2;
y1 = -3:3:.2;
z1 = zeros (x1.n, y1.n);
for (i in 1:x1.n)
{
for(j in 1:y1.n)
{
z1[i;j] = sin(y1[j]) * cos(x1[i]);
}
}
# Now create some plots
xlabel("X-Axis");
ylabel("Y-Axis");
pltitle ("Contour Demonstration");
plmesh (<< x = xx; y = yy; z = zz>>);
pause();
plaspect(0.5);
pltitle ("Contour Demonstration, Aspect = 0.5");
plcont (<< x = xx; y = yy; z = zz>>);
plaspect ();
pause();
pltitle ("Contour Demonstration");
plmesh (<< x = x1; y = y1; z = z1>>);
pause();
pltitle ("Contour Demonstration, Aspect = 1.0");
plcont (<< x = x1; y = y1; z = z1>>);